<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        /*
        function foo(){
            alert('foo');
        }
        function foo2(s){
            alert(s);
        }
        function foo3(a,b){
            alert(a+b);
        }
        foo();
        foo2("你好");
        foo3(3+3,8);
        */

        //形参多于实参
        function foo4(){
            console.log(arguments); //测试打印参数对象
            var s = '';
            if (arguments.length>0){
                    //循环参数，
                for (var i = 0;i<arguments.length;i++){
                    s += arguments[i]   //读取具体的参数
                }
            }
            console.log(s);
        }
        foo4('aaaa','b','c');   //不定参数

        //形参少与实参
    </script>
</body>
</html>